<template>
    <view class="content">
        <view class="box" v-for="(item, index) in list" :key="index" @click="toDetails(item)">
            <view class="top">
                <view class="item u-flex-1">
                    <view class="left">订单编号</view>
                    <view class="right">{{item.out_trade_no}}</view>
                </view>
				<view class="o-sta1" v-if="item.order_type == 1">零担</view>
				<view class="o-sta2" v-if="item.order_type == 2">包车</view>
            </view>
            <view class="item">
                <view class="left">下单日期</view>
                <view class="right">{{item.create_time}}</view>
            </view>
            <view class="item">
                <view class="left">发货方</view>
                <view class="right">{{item.shipper}}</view>
            </view>
            <view class="item">
                <view class="left">联系人</view>
                <view class="right">{{item.shipper_contact}}</view>
            </view>
            <view class="item">
                <view class="left">联系方式</view>
                <view class="right">{{item.shipper_phone}}</view>
            </view>
            <view class="item">
                <view class="left">装车地点</view>
                <view class="right">{{item.loading_site}}</view>
            </view>
            <view class="item">
                <view class="left">收货地址</view>
                <view class="right">{{item.address}}</view>
            </view>
            <view class="item">
                <view class="left">经营位置</view>
                <view class="right">{{item.position}}</view>
            </view>
            <view class="item">
                <view class="left">联系人</view>
                <view class="right">{{item.recipient_contact}}</view>
            </view>
            <view class="item">
                <view class="left">联系方式</view>
                <view class="right">{{item.recipient_phone}}</view>
            </view>
        </view>
		
		<view style="height: 94rpx;padding-top: 30rpx;">
		    <u-loadmore :status="status" v-if="status != 'loadmore'" />
		</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                id: '',
                status: 'loadmore', //是否显示没有更多了
                page: 1,
                list: [],
            };
        },
        onLoad(option) {
            this.id = option.id
        	this.getList()
        },
        onReachBottom() {
        	if(this.page == 1){return}
        	this.getList()
        },
        methods: {
            toDetails(item) {
				this.$gTo(`/pages/abnormal/abnormal?out_trade_no=${item.out_trade_no}`)
			},
			
			getList() {
				if (this.status == 'nomore') return;
				this.status = 'loading';
				this.$ajax('shipping_orders', {
					user_token: this.$getSync('userToken'),
					page: this.page,
					limit: 10,
			        car_id: this.id,//车辆运单id
				}).then(ret => {
					if (ret.success == 1000) {
						if (ret.detail && ret.detail.orders && ret.detail.orders.length > 0) {
							this.list = this.list.concat(ret.detail.orders);
							this.page++;
							this.status = 'loadmore'
						} else {
							this.status = 'nomore'
						}
					} else {
						this.$toast(ret.msg);
					}
				});
			},
        }
    };
</script>

<style lang="scss">
    .img{
        width: 240rpx;
        height: 170rpx;
    }
    
    
    page{
        background-color: #eef1f6;
    }
    .content{
        padding-bottom: 50rpx;
    }
    .nav{
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 30rpx 0;
        border-bottom: 2rpx solid #ebebeb;
        background-color: #fff;
    }
    .nav-i{
        width: calc(100vw / 2);
        font-size: 28rpx;
        text-align: center;
        position: relative;
    }
    .ord-num{
        font-size: 20rpx;
        line-height: 1;
        color: #fff;
        padding: 5rpx 8rpx;
        background-color: #fa3c07;
        border-radius: 50%;
        position: absolute;
        right: -5rpx;
        top: -20rpx;
    }
    .ord-num2{
        font-size: 20rpx;
        line-height: 1;
        color: #fff;
        padding: 6rpx 4.5rpx;
        background-color: #fa3c07;
        border-radius: 50%;
        position: absolute;
        right: -5rpx;
        top: -20rpx;
    }
    .active{
        color: #004580;
        font-weight: bold;
        position: relative;
    }
    .active::after{
        display: block;
        content: '';
        width: 32rpx;
        height: 8rpx;
        background-color: #004580;
        position: absolute;
        bottom: -30rpx;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .box{
        background-color: #fff;
        border-radius: 15rpx;
        padding: 40rpx 30rpx 30rpx;
        margin: 16rpx 20rpx 0;
    }
    .top{
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .item{
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 10rpx;
    }
    .left{
        width: 185rpx;
        color: #656565;
    }
    .right{
        flex: 1;
        word-break: break-all;
        white-space: pre-line;
    }
    .o-sta{
        font-size: 24rpx;
        color: #ff602c;
        padding-bottom: 10rpx;
        padding-left: 10rpx;
    }
    .o-sta1{
        font-size: 24rpx;
        color: #ff602c;
        padding: 7rpx 15rpx;
        background-color: #fff1ec;
        border-radius: 10rpx;
        margin-left: 10rpx;
        margin-bottom: 10rpx;
    }
    .o-sta2{
        font-size: 24rpx;
        color: #0075ff;
        padding: 7rpx 15rpx;
        background-color: #ebf4fe;
        border-radius: 10rpx;
        margin-left: 10rpx;
        margin-bottom: 10rpx;
    }
    .price{
        font-size: 26rpx;
        color: #ff602c;
    }
    .price-num{
        font-size: 38rpx;
    }
    .btns{
        padding-top: 10rpx;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        color: #fff;
    }
    .btn1{
        padding: 15rpx 25rpx;
        background-color: #004580;
        border-radius: 50rpx;
        margin-left: 20rpx;
    }
    .btn2{
        padding: 15rpx 25rpx;
        background-color: #9aafc2;
        border-radius: 50rpx;
        margin-left: 20rpx;
    }
    .btn3{
        padding: 15rpx 25rpx;
        background-color: #fff;
        border-radius: 50rpx;
        margin-left: 20rpx;
        color: #004580;
        border: 2rpx solid #004580;
        box-sizing: border-box;
    }
    
    
    .popup{
        padding: 30rpx;
    }
    .pop-title{
        font-size: 34rpx;
        font-weight: bold;
        text-align: center;
        padding-bottom: 40rpx;
    }
    .pop-tip{
        font-size: 24rpx;
        color: #fe6a00;
        padding-top: 20rpx;
        padding-bottom: 50rpx;
    }
    .t-inp{
        padding: 20rpx;
        background-color: #f5f5f5;
        border-radius: 10rpx;
        font-size: 26rpx;
        width: 100%;
        min-height: 220rpx;
    }
    .pop-btn{
        font-size: 30rpx;
        color: #fff;
        text-align: center;
        padding: 20rpx;
        background-color: #00457f;
        border-radius: 50rpx;
    }
    

</style>
